// 提示 赞和踩
function evaluattips(obj,text){
    if( $(obj).siblings().hasClass("on")){  //避免重复点击
        layer.msg(text);
        return false;
    }
    $(obj).toggleClass("on");
    var tex=parseInt($(obj).find("u").text())
    if($(obj).hasClass("on")){
        $(obj).find("u").text(tex+1)
    }else{
       $(obj).find("u").text(tex-1)
    }
}
// 点赞
function evaluatezan(obj){
    evaluattips(obj,'您已经踩过了，请勿重复点击')
}
// 踩
function evaluatenstepon(obj){
    evaluattips(obj,'您已经点赞过了，请勿重复点击')
}
// 回复下拉框
function evaluatereply(obj){
    var that = $(obj).parents(".EV_list");
    if(that.parents(".evaluatewarp").hasClass("commentswrap")){
        var name=that.find(".name_p .name").text()
    }else{
        var name=that.find(".user_ .name").text() 
    }
    var text=that.find(".text_p p").text()
    $(".layerevaluate .text .bt span").text(name)
    $(".layerevaluate .text .p").text(text)
    openlayerevaluate()
}
// 显示 评价弹出层
function openlayerevaluate() {
    layer.closeAll();
    var layer_box = layer.open({
        type: 1,
        skin: 'layerevaluatewarp',
        title: false,
        closeBtn: 1,
        shadeClose: false,
        content: $('.layerevaluate')
    });
}

layui.use(['rate'], function(){
    var rate = layui.rate;
      //自定义文本
  rate.render({
    elem: '#evaluate_total_stare',
    // value: 3,
    text: true,
    theme:'#0066ff',
    setText: function(value){ //自定义文本的回调
      var arrs = {
        '1': '讨厌'
        ,'2': '不推荐'
        ,'3': '还行'
        ,'4': '值得推荐'
        ,'5': '完美'
      };
      this.span.text(arrs[value] || (  ""));
    },
    choose: function(value){
        if(value > 4) alert( '么么哒' )
      }
  })
})

// 展开全部楼中楼评论
$(".evaluatewarp .evaluatelist .EV_list .item_ .children .moreli").click(function(){
    $(this).hide();
    $(this).parents(".children").find("li").addClass("flexon")
})


